//
//  RunTimeExample.m
//  DailyTest
//
//  Created by hjk on 16/6/24.
//  Copyright © 2016年 kobehjk. All rights reserved.
//

#import "RunTimeExample.h"
#import <objc/runtime.h>
#import <objc/message.h>



@implementation RunTimeExample

+(void)creatClassAndMethod
{
    Class newClass = objc_allocateClassPair([UIViewController class], "controlClass", 0);
    class_addMethod(newClass, @selector(printClass), (IMP)print, "v@:");
    objc_registerClassPair(newClass);
    
    id instance = [[newClass alloc]init];
    [instance performSelector:@selector(printClass)];
    
}

void print()
{
    NSLog(@"-----im here!!!------");
}

//void PrintMetaClass(id self,SEL _cmd)
//{
//    NSLog(<#NSString * _Nonnull format, ...#>)
//}

@end
